home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / vgamaze4.zip / HEXMAZE.H < prev    next >
C/C++ Source or Header  |  1994-02-14  |  4KB  |  124 lines

  1. #ifndef HEXMAZE_H
  2. #define HEXMAZE_H
  3.  
  4. //      Each instance of this class is a maze having hexagonal rooms.
  5.  
  6. //      This class uses the classes "cell" (room of a maze), "oracle"
  7. // (random number generator), and "titillat" (amuse user).
  8.  
  9. class maze
  10.   {
  11.     private:
  12.       oracle     *column_selector;
  13. //      Random number generator to select column to start constructing maze.
  14.  
  15.       struct
  16.         {
  17.            int row_num;
  18.            int column_num;
  19.         }        current;
  20. //      Current location in maze.
  21.  
  22.       void       draw_line_on_page(int x1,int y1,int x2,int y2);
  23. //      Draw wall (of bricks) on "page".
  24.  
  25.       int        max_x;
  26.  
  27.       int        memory_allocated;
  28. //      The memory for the maze has been allocated.
  29.  
  30.       int        num_columns;
  31. //      Number of columns in maze.
  32.  
  33.       int        num_rows;
  34. //      Number of rows in maze.
  35.  
  36.       int        num_x_dots;
  37. //      Number of columns of bricks in maze.
  38.  
  39.       int        num_y_dots;
  40. //      Number of rows of bricks in maze.
  41.  
  42.       oracle     *order_selector;
  43. //      Random number generator to select the order walls are to considered.
  44.  
  45.       char       **page;
  46. //      Two dimensional plot of maze, one element per possible brick position.
  47. // 'W' if brick is present; ' ' otherwise.
  48.  
  49.       cell       **room;
  50. //      Two dimensional array of rooms composing the maze.
  51.  
  52.       oracle     *row_selector;
  53. //      Random number generator to select row to start constructing maze.
  54.  
  55.       void       set_point_on_page(int x,int y);
  56. //      Place a section of wall on "page".  Each section is "wall_thickness"
  57. // bricks long and "wall_thickness" bricks wide.
  58.  
  59.       titillator *titillator_ptr;
  60. //      Keep the user amused while the maze is constructed.
  61.  
  62.       struct
  63.         {
  64.            int row_num;
  65.            int column_num;
  66.         }        first;
  67. //      Location of the starting room.
  68.  
  69.       int        wall_thickness;
  70. //      Thickness of wall in "bricks".
  71.  
  72.       int        x_dot_max;
  73. //      num_x_dots-1
  74.  
  75.       int        y_dot_max;
  76. //      num_y_dots-1
  77.  
  78.     public:
  79.  
  80.       int    constructed(void) {return memory_allocated;}
  81. //      Return TRUE if and only if the maze is successfully constructed.
  82.  
  83.       int    external_to_maze(double x,double y);
  84. //      Return TRUE if and only if a point (x,y) is external to the maze.
  85.  
  86.       double f(double x,double y);
  87. //      Return 5.0*wall_thickness if a point (x,y) is on a wall, 0.0 otherwise.
  88.  
  89.              maze(int row_count,int column_count,int thickness_of_wall,
  90.               char *seed);
  91. //      Contruct a maze having "row_count" rows and "column_count" columns of
  92. // rooms.  The walls should be "thickness_of_wall" (bricks) thick.  A different
  93. // (8 character of less) "seed" generally yields a different maze.
  94.  
  95.              ~maze(void);
  96.  
  97.       int    maze_okay(void);
  98. //      TRUE if and only if solving the maze is difficult enough.
  99.  
  100.       int    num_x_divisions(void) {return num_y_dots+2;}
  101. //      Recommended number of x divisions for plotting f(x,y).
  102.  
  103.       int    num_y_divisions(void) {return num_x_dots+2;}
  104. //      Recommended number of y divisions for plotting f(x,y).
  105.  
  106.       int    part_of_solution(double x,double y);
  107. //      Return TRUE if and only if a point (x,y) is on a wall outlining the
  108. // solution to the maze.
  109.  
  110.       double x_max(void) {return double(num_y_dots);}
  111. //      Recommended maximum value of x for plotting f(x,y).
  112.  
  113.       double x_min(void) {return(-1.0);}
  114. //      Recommended minimum value of x for plotting f(x,y).
  115.  
  116.       double y_max(void) {return double(num_x_dots);}
  117. //      Recommended maximum value of y for plotting f(x,y).
  118.  
  119.       double y_min(void) {return(-1.0);}
  120. //      Recommended minimum value of y for plotting f(x,y).
  121.   };
  122.  
  123. #endif
  124.